﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Face8280WebSocketServer.DTO.FaceDevice
{
    public class FaceDeviceStatus
    {
        public int Id { get; set; }
        /// <summary>
        /// 设备SN
        /// </summary>
        public string DeviceSn { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        public string DeviceName { get; set; }
        /// <summary>
        /// 设备IP
        /// </summary>
        public string DeviceIP { get; set; }
        /// <summary>
        /// 设备端口
        /// </summary>
        public int DevicePort { get; set; }
        /// <summary>
        /// 连接类型
        /// </summary>
        /// <value>0--服务端；1--客户端</value>
        public byte ConnectType { get; set; }
        /// <summary>
        /// 通讯令牌
        /// </summary>
        public string Token { get; set; }
        public DateTime LastKeepaliveTime { get; set; }

        public DateTime OnlineTime { get; set; }

        public int AlarmStatus { get; set; }

        public int DoorStatus { get; set; }

        public Queue<object> AddPeople { get; set; } = new Queue<object>();

        public HashSet<uint> DeletePeople { get; set; } = new HashSet<uint>();

        public bool DeleteAllPeople { get; set; }
        public bool ClaerPeople { get; set; }

        public string Ups { get; set; }
        /// <summary>
        /// 主电源电压
        /// </summary>
        public string Voltage { get; set; }
        /// <summary>
        /// 工作环境温度(摄氏度)
        /// </summary>
        public string Temperature { get; set; }
        /// <summary>
        /// 继电器物理状态 0--COM和NC常闭；1--COM和NO常闭
        /// </summary>
        public int Relay { get; set; }
        /// <summary>
        /// 常开状态0表示常闭，1常开
        /// </summary>
        public int Keepopen { get; set; }
        /// <summary>
        /// 门磁状态 0表关，1表示开
        /// </summary>
        public int DoorSensor { get; set; }
        /// <summary>
        /// 电锁状态 0表关，1表示开
        /// </summary>
        public int LockSensor { get; set; }
        /// <summary>
        /// 锁定状态0--未锁定，1--锁定
        /// </summary>
        public int Locked { get; set; }
        /// <summary>
        /// 消息推送状态0--禁用，1--启用
        /// </summary>
        public int MsgPush { get; set; }
        /// <summary>
        /// 报警状态，无报警为空字符串，多个报警用逗号分隔多个报警名称
        /// fire 消防报警
        /// blacklist 黑名单报警
        /// anti 防拆报警
        /// Illegal 非法验证
        /// password 胁迫报警密码
        /// openTimeout 开门超时报警
        /// </summary>
        public string Alarm { get; set; }
        /// <summary>
        /// 电梯继电器状态 ,连续的由0/1组成的状态字符串，长度64个字符
        /// </summary>
        /// <value>
        /// 001100000000110000000001......1
        /// </value>
        /// <remarks>
        /// 从左到右依次表示1号继电器到64号继电器。其中元素值为0表示COM&NC；1表示COPM&NO
        /// </remarks>
        public string Relays { get; set; }

        public FaceDeviceStatus Copy(DB.Device.FaceDeviceInfo info)
        {
            Id = info.Id;
            DeviceSn = info.DeviceSn;
            DeviceName = info.DeviceName;
            DeviceIP = info.DeviceIP;
            DevicePort = info.DevicePort;
            ConnectType = info.ConnectType;
            Token = info.Token;
            return this;
        }

        
    }
}
